package 线程2;
//线程的状态state -- 用于辅助系统对于线程进行调度这样的属性
public class TestDemo7 {
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(){
            @Override
            public void run() {
//             * 获取线程内置的标记位:线程的isinterrupted()判断当前线程是不是应该要结束循环 Thread.currentThread().isInterrupted();
//             * 修改线程内置的标记位:Thread.interrupt()来修改这个标记位
                while(!Thread.currentThread().isInterrupted()){

                }
            }
        };
        System.out.println(t.getId() + ": "+t.getState());
        t.start();
        System.out.println(t.getId() + ": "+t.getState());
        Thread.sleep(3000);
        t.interrupt();
//        Thread.sleep(1000);//有这个下面的打印是,TERMINATED,没有则是RUNNABLE
        System.out.println(t.getId() + ": "+t.getState());
    }
}
